//
//  UserModel.swift
//  kxf
//
//  Created by Mac on 2024/3/7.
//

import Foundation

class UserModel {
    
    static let shared = UserModel()
    
    var name = ""
    var phone = ""
    var phoneStar = ""
    var isCheck = false
    var failResult = ""
    var icon = ""
    var identity = ""
    var mchId = ""
    var mchName = ""
    var mchType = ""
    var memberId = ""
    var partnerLevelId = ""
    var posStatus = ""
    var realName = ""
    var roles = ""
    var signPhone = ""
    var signType = ""
    var sn = ""
    var userId = ""
    var inviteCode = ""
    var codePlateUrl = ""
    
    var agentId = ""
    var agentName = ""
    var agentPhone = ""
    
    var verifyStatus = ""
    var verifyStatusInt = 0
    var isShowRate = ""//是否显示费率
    
    var posChannel = "ys"
    var posChannelName = ""
    
    var settleCycle = ""
    var settleCycleName = ""
    var auditTime = ""
    
//    var accessKeyId = ""
//    var accessKeySecret = ""
//    var endPoint = "https://oss-cn-beijing.aliyuncs.com"
    
    private init(){
        
    }
    func updateUserInfo(userInfo:NSDictionary) {
        self.roles        = "\(userInfo["roles"]as? String ?? "")"
        self.realName     = "\(userInfo["realName"]as? String ?? "")"
        self.posStatus    = "\(userInfo["posStatus"]as? Int ?? 0)"
        self.phoneStar    = "\(userInfo["phone"]as? String ?? "")"
        self.phone        = "\(userInfo["username"]as? String ?? "")"
        self.identity     = "\(userInfo["identity"]as? String ?? "")"
        self.signPhone    = "\(userInfo["signPhone"]as? String ?? "")"
        self.failResult   = "\(userInfo["failResult"]as? String ?? "认证失败")"
        self.mchType      = "\(userInfo["mchType"]as? String ?? "")"
        self.userId       = "\(userInfo["userId"]as? Int ?? 0)"
        self.memberId     = "\(userInfo["memberId"]as? Int ?? 0)"
        self.mchId        = "\(userInfo["mchId"]as? String ?? "")"
        self.icon         = "\(userInfo["icon"]as? String ?? "")"
        self.mchName      = "\(userInfo["mchName"]as? String ?? "")"
        self.signType     = "\(userInfo["signType"]as? String ?? "")"
        self.sn           = "\(userInfo["sn"]as? String ?? "")"
        self.name         = "\(userInfo["realName"]as? String ?? "")"
        self.partnerLevelId = "\(userInfo["partnerLevelId"]as? Int ?? 0)"
        self.inviteCode   = "\(userInfo["inviteCode"]as? String ?? "")"
        self.codePlateUrl = "\(userInfo["codePlateUrl"]as? String ?? "")"
        
        self.agentId      = "\(userInfo["agentId"]as? Int ?? 0)"
        self.verifyStatus  = "\(userInfo["verifyStatus"]as? Int ?? 0)"
        self.verifyStatusInt = userInfo["verifyStatus"]as? Int ?? 0
        self.isShowRate = "\(userInfo["isShowRate"]as? String ?? "")"
        
        self.agentPhone = "\(userInfo["agentPhone"]as? String ?? "")"
        
        self.agentName = "\(userInfo["agentName"]as? String ?? "\(self.agentPhone)")"
        
        self.posChannel = userInfo["posChannel"]as? String ?? "ys"
        self.posChannelName = userInfo["posChannelName"]as? String ?? ""
        
        self.settleCycle = userInfo["settleCycle"]as? String ?? ""
        self.settleCycleName = userInfo["settleCycleName"]as? String ?? ""
        self.auditTime = userInfo["auditTime"]as? String ?? ""
        
        
//        if self.posChannel == "ys"{
//            self.posChannelName = "易胜"
//        }else if self.posChannel == "sxy"{
//            self.posChannelName = "首信义"
//        }
    }
}
